package controllers

import (
	"github.com/astaxie/beego"
	"math/rand"
	"time"
)

type RandController struct {
	beego.Controller
}

func (c *RandController) Get() {
	c.Data["data"] = modbusdata()
	c.TplName = "rand.tpl"
}

//产生随机数组
func createRandomNum() [10]int {
	var data [10]int
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	for i := 0; i < 10; i++ {
		data[i] = r.Intn(350) + 150
	}
	return data
}
